/////////////////////////////////////////////////////////////////////
//
//  MOE Framework (Meta Object Encapsulation Framework)
//
//  Original Author: Wiksy Wang, 2011
//
/////////////////////////////////////////////////////////////////////

#ifndef MOE_MAP_OBJECT_TO_NAME_QUERY_H
#define MOE_MAP_OBJECT_TO_NAME_QUERY_H

#include <map>
#include "IObjectToNameQuery.h"

namespace MOE
{

namespace Name
{

// Use an associative containter such as std::map to store object-to-name pairs.
// The pair can then be used in an object-to-name query that will cost 1 find operation.
// For std::map this cost will be O(logN).
class MapObjectToNameQuery : public IObjectToNameQuery
{
public:
	virtual ~MapObjectToNameQuery();

	virtual void AddObject(Address object, const RawByteVector& name);
	virtual void RemoveObject(Address object);
	virtual const RawByteVector& GetObjectName(Address object) const;

private:
	typedef std::map<Address, RawByteVector> MapType;

	MapType _map;
};

}

}

#endif
